#!/usr/bin/make -f


BUILD_ROOT=$(CURDIR)/debian/tmp
install:
	rm -rf ${BUILD_ROOT}
	mkdir -p ${BUILD_ROOT}/var/opencore/modules/PostfixCourier.module
	mkdir -p ${BUILD_ROOT}/etc/openpanel
	mkdir -p ${BUILD_ROOT}/var/opencore/bin
	cp -rf ./postfixcouriermodule.app ${BUILD_ROOT}/var/opencore/modules/PostfixCourier.module/
	cp module.xml techsupport.* ${BUILD_ROOT}/var/opencore/modules/PostfixCourier.module/
	cp *.png ${BUILD_ROOT}/var/opencore/modules/PostfixCourier.module/
	ln -sf postfixcouriermodule.app/exec ${BUILD_ROOT}/var/opencore/modules/PostfixCourier.module/action
	install -m 750 RedHat/postinst ${BUILD_ROOT}/var/opencore/modules/PostfixCourier.module/postinst
	install -m 750 postarray ${BUILD_ROOT}/var/opencore/bin/postarray
	install -m 755 masterconf ${BUILD_ROOT}/var/opencore/bin/masterconf
	install -m 755 fixconfig ${BUILD_ROOT}/var/opencore/modules/PostfixCourier.module/fixconfig
	install -m 755 verify ${BUILD_ROOT}/var/opencore/modules/PostfixCourier.module/verify

build:
	./configure
	make
binary-indep:

binary-arch binary: build install
	if [ -d debian/tmp ] ; then dh_install -a --sourcedir=debian/tmp ; fi
	dh_installdocs -a
	dh_installdeb -a
	dh_compress -a
	dh_fixperms -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

.PHONY: build binary binary-arch binary-indep clean install
